Skip to content

feat!: make contract classes dynamic#24282

Merged
nventuro merged 18 commits into
merge-train/fairies-v5from
nv/dynamic-current-class
Jul 2, 2026
Merged

feat!: make contract classes dynamic#24282
nventuro merged 18 commits into
merge-train/fairies-v5from
nv/dynamic-current-class

Conversation

@nventuro

Copy link
Copy Markdown
Contributor

This makes PXE stop trying to track a contract's current class. Instead, we fetch it on the fly from the node (which we already had to do anyway to make sure PXE's tracking of it was not out of sync). As a result, pxe.updateContract gets deleted.

I introduced a contract class service, which deals with the interaction with the node for determining the current class (plus a cache to avoid repeated roundtrips), and an anchored contract data class for a given execution. There are some rough edges here (mostly in pxe.ts, which contains too much inlined code, and in some cases which receive both the anchored data and the raw store because the anchored data doesn't expose enough), but it's good enough for now I think. I created multiple follow up issues to clean some of this up.

With this weird current class management gone, registerContract also became less important, so I simplified it to only take an instance, with registerContractClass taking the artifact. Both must be called.

I also introduced a simpler version of ContractInstance (ContractInstacePreimage) which does not contain the current class - something only the AVM and the node care about - this is what PXE uses throughout. Once we fork the monorepo I imagine ContractInstance would be deleted on our side.

Most other changes result from these decisions - the effects were quite far reaching.

@nventuro
nventuro requested a review from nchamo June 24, 2026 21:23
nventuro added 2 commits June 25, 2026 02:59
# Conflicts:
#	yarn-project/pxe/src/contract_function_simulator/oracle/oracle_type_mappings.ts

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much needed work!

FYI Claude suggested we should also make some updates to simulated_tx.ts

Comment thread yarn-project/pxe/src/contract/contract_class_service.ts Outdated
Comment thread docs/docs-developers/docs/aztec-js/how_to_test.md
Comment thread yarn-project/pxe/src/storage/contract_store/contract_store.ts
Comment thread yarn-project/wallet-sdk/src/base-wallet/base_wallet.ts Outdated
Comment thread yarn-project/txe/src/utils/txe_public_contract_data_source.ts
Comment thread yarn-project/txe/src/utils/txe_public_contract_data_source.ts
Comment thread yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts Outdated
Comment thread yarn-project/pxe/src/storage/contract_store/contract_store.ts
Comment thread yarn-project/pxe/src/contract_function_simulator/anchored_contract_data.ts Outdated
@nventuro
nventuro requested a review from a team as a code owner June 26, 2026 21:41
@nventuro
nventuro requested a review from nchamo June 26, 2026 21:42

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Comment thread yarn-project/pxe/src/contract/contract_class_service.ts
Comment thread yarn-project/pxe/src/storage/contract_store/contract_store.ts
Reconcile crossed renames: adopt fairies-v5's TxResolverService/ResolvedTx naming while keeping this branch's contract/ dir and ContractClassService. Keep the dynamic contract-class registration model (preimage input, no updateContract/currentContractClassId validation) and layer in fairies-v5's secretKeyOrKeys parameter. Rewire private_execution_oracle's resolveCustomRequest/tagging hooks to resolve the current class id via AnchoredContractData instead of the removed instance field.
@nventuro
nventuro requested a review from LeilaWang as a code owner July 1, 2026 19:20
@nventuro
nventuro enabled auto-merge (squash) July 1, 2026 19:20
@nventuro
nventuro merged commit 8486183 into merge-train/fairies-v5 Jul 2, 2026
12 checks passed
@nventuro
nventuro deleted the nv/dynamic-current-class branch July 2, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants